]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
scroll-view-fade: Tweak easing at edges
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 23 Feb 2013 00:37:05 +0000 (01:37 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 1 Mar 2013 16:30:01 +0000 (17:30 +0100)
Since commit b4f5f1e46174, the effect is eased in at the scroll
view's edges so that it does not appear out of nowhere. However,
the linear easing used is not the best option, as now the effect
appears so late that content near the edges ends up just being
cut off rather than faded out.
So adjust the easing function to have the effect appear faster.

https://bugzilla.gnome.org/show_bug.cgi?id=694327

src/st/st-scroll-view-fade.glsl

index 6acd260006894410614882a032a9ab6908cba24f..e8bd03a2a5e49f7b1830e8e8e0856d9f5b049a67 100644 (file)
@@ -64,20 +64,20 @@ void main ()
 
     float vfade_scale = height / vfade_offset;
     if (fade_top) {
-        ratio *= FADE((y / vfade_offset), min(vvalue * vfade_scale, 1.0));
+        ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0));
     }
 
     if (fade_bottom) {
-        ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min((1.0 - vvalue) * vfade_scale, 1.0));
+        ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 - vvalue) * vfade_scale, 1.0));
     }
 
     float hfade_scale = width / hfade_offset;
     if (fade_left) {
-        ratio *= FADE(x / hfade_offset, min(hvalue * hfade_scale, 1.0));
+        ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0));
     }
 
     if (fade_right) {
-        ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min((1.0 - hvalue) * hfade_scale, 1.0));
+        ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue) * hfade_scale, 1.0));
     }
 
     cogl_color_out *= ratio;